import java.util.Arrays;

public class Test {
    public static void rotate(int[] arr1, int k) {//https://leetcode.cn/problems/rotate-array/
        if(k> arr1.length){
            return;
        }else{
            int n=arr1.length;
            int[] arr2=new int[n];
            for(int i=0;i<n;i++){
                arr2[(i+k)%n]=arr1[i];
            }
            for(int i=0;i<n;i++){
                arr1[i]=arr2[i];
            }
        }
    }
    public static void main(String[] args) {
        int[] nums={1,2,3,4,5,6};
        rotate(nums,3);
        System.out.println(Arrays.toString(nums));
    }
}
